<!--   
Persistent Digital Archives and Library System (PeDALS) 
(c) 2008 - All Rights Reserved
//-->
<?php 
include 'includes\config.php'; 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Persistent Digital Archives and Library System" />
<title>PeDALS Web Administration</title>
<link rel="shortcut icon" href="images/favicon.ico" />
<link href="includes/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include 'includes\header.php'; ?>
<div id="breadcrumb-container">
  <div id="breadcrumb"><a href="index.php" title=Home page">Home</a> / Series</div>
  <div id="breadcrumb-side"><form name="search" action="search.php"><input type="text" name="q" width="50"/><input type="submit" value="Go" /></form><a href="advSearch.php" title="Advanced Search" alt="Advanced Search">Advanced Search</a>
  </div>
  <div class="clear"></div>
</div>
<!-- 

  CONTENT

  -->
<div id="content-container">
  <!-- 
	
	SIDE COLUMN
	
	-->
  <div id="content-side">
    <ul class="link-list-vertical">
      <li><a href="serNew.php" title="Add a new series to PeDALS.">Add Series</a></li>
    </ul>
  </div>
  <!-- 
	
	MAIN COLUMN
	
	-->
  <div id="content"><a name="maincontent" id="maincontent"></a>
    <h1>Series</h1>
    
        <table class="table" border="1" cellspacing="0" summary="Table listing all the series set up in PeDALS">
      <thead>
        <tr>
          <th scope="col">Provenance</th>        
          <th scope="col" abbr="name">Series Name</th>
          <th scope="col">View</th>
          <th scope="col">Edit</th>
        </tr>
      </thead>
      <tbody>
<?php	
 	$tsql = "{call pac_GetSeries}"; 
 	/* Create the statement. */
	$getData = sqlsrv_prepare( $conn, $tsql);
	if( $getData )
	{ 	}
	else
	{
		 echo "Error in preparing statement.\n";
		 die( print_r( sqlsrv_errors(), true));
	}

	/* Execute the statement. Display any errors that occur. */
	if( sqlsrv_execute( $getData))
	{ 	}
	else
	{
		 echo "Error in executing statement.\n";
		 die( print_r( sqlsrv_errors(), true));
	}

	$rowCount = 0;

	
	while (sqlsrv_fetch( $getData ))
	{
		$seriestitle = sqlsrv_get_field($getData, 0);
		$seriesid = sqlsrv_get_field($getData, 1);
		$provname = sqlsrv_get_field($getData, 2);
		
		echo "<tr>";
		echo "<td align=\"left\" valign=\"top\" >".$provname."</td>";		
		echo "<td align=\"left\" valign=\"top\" >";
		echo "<a title=\"".$seriestitle."\"";
		echo " alt=\"".$seriestitle."\"";
		echo " href=serDetail.php?ser=".$seriesid."";
		echo ">".$seriestitle."</a></td>";
		echo "<td align=\"center\" valign=\"top\" >";
		echo "<a title=\"View\"";
		echo " alt=\"View\"";
		echo " href=serDetail.php?ser=".$seriesid."";
		echo "><img src='images/view.png' border=0/></a></td>";
		echo "<td align=\"center\" valign=\"top\" >";
		echo "<a title=\"Edit\"";
		echo " alt=\"Edit\"";
		echo " href=serEdit.php?ser=".$seriesid."";
		echo "><img src='images/edit.png' border=0/></a></td>";		
		echo "</tr>";	
			
		$rowCount++;
    }	

	
	if( $rowCount == 0 ) { 
	    echo "<h4>There are no series yet.</h4>"; 
    	}
	
    sqlsrv_free_stmt( $getData );	

	sqlsrv_close( $conn);

?>      
    </tbody>
    </table>
<?php include 'includes\footer.php'; ?>
  </div>
</div>
</body>
</html>